package com.liudehua.controller;

import com.liudehua.boot.context.Context;
import com.liudehua.boot.interfaces.RedisInterface;
import com.liudehua.service.UserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    public UserService userService;
    @DubboReference
    public RedisInterface redisInterface;

    @GetMapping(value = "/test")
    @ResponseBody
    public String cccc(){
        Context.getInstance().put("contryCode","MX");
        Context.getInstance().get("contryCode");
        return userService.user();
    }


    @GetMapping(value = "/test1")
    @ResponseBody
    public String cccc1(){
        redisInterface.put("liudehua","OK");
        return redisInterface.get("liudehua");
    }
}
